< previous page page_197 next page >

Page 197
1/15
2/15
1/15
2/15
3/15
2/15
1/15
2/15
1/15

1/20
1/20
1/20
1/20
12/20
1/20
1/20
1/20
1/20

All low-pass filters have two things in common: They are symmetric around their centers, and the sum of their coefficients equals 1. If a kernel is not symmetric, the filter produces an uneven smoothing. For instance, suppose the coefficients on the right side of the kernel were larger than those on the left. Then the output value for a pixel with bright neighbors to its right would be brighter than one with dark neighbors to its right. Many of the sections that follow use asymmetric kernels to enhance edges with different orientations.
If the weight of the kernel does not equal 1, the resulting image is either lighter or darker than the original. For example, suppose a kernel's coefficients add up to 2 instead of 1. If you apply that kernel to a region where every pixel had a color value of 100, the resulting value would be 2 * 100 = 200, a much brighter color value than 100. Doubling the total of the coefficients roughly doubles the brightness of the resulting image.
Unsharp Masking
Interestingly, you can sharpen an image by subtracting a scaled version of the result of low-pass filtering from the original image. This process is called unsharp masking. Unsharp masking enhances the changes in high-frequency areas, making those areas more noticeable and making the image appear sharper.
Example program Unsharp, shown in Figure 7.3, subtracts a low-pass filtered version of an image from twice the original value. For example, if a pixel's value is P0 in the original image and P1 after low-pass filtering, the program makes the pixel's final value 2 * P0 P1.
High-Pass Filters
Low-pass filters allow low-frequency components of an image to pass through while blurring high-frequency components. High-pass filters do the opposite: They accentuate the high-frequency parts of an image while leaving low-frequency components mostly unchanged.
The following kernels produce high-pass filters. Like the kernels of low-pass filters, they are symmetric around their centers, and the sum of the coefficients in each is 1. These conditions ensure that the kernel produces an even enhancement and does not change the overall brightness of the image.

 
< previous page page_197 next page >